import './assets/main.css'

import { createApp, type App } from 'vue'
import { createPinia } from 'pinia'

import AppVue from './App.vue'
import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import ElementPlus from 'element-plus'
let app: App
if (window.__POWERED_BY_WUJIE__) {
  window.__WUJIE_MOUNT = () => {
    createVueApp()
  }
  window.__WUJIE_UNMOUNT = () => {
    app.unmount()
  }
} else {
  createVueApp()
}

function createVueApp() {
  app = createApp(AppVue)
  app.use(ElementPlus)
  app.use(createPinia())
  app.use(router)
  for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
  }
  app.mount('#app')
}
